package com.gxd.esimport;

import org.elasticsearch.action.index.IndexRequest;

import java.sql.*;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.Date;
import java.util.concurrent.Executors;
import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit;

public class ScheduledExecutorTest  implements Runnable{

    private String jobName = "";

    public ScheduledExecutorTest(String jobName) {
        super();
        this.jobName = jobName;
    }

    @Override
    public void run() {
        System.out.println("execute " + jobName);
        try {
            tableList.initNavTables();
            tableList.initCaseTables();
            System.out.println("tableList.NavWhere:"+tableList.NavWhere+"tableList.CaseWhere:"+tableList.CaseWhere+"tableList.UserAccessWhere:"+tableList.UserAccessWhere+"tableList.RentWhere:"+tableList.RentWhere);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }


    public static void main(String[] args) {

        ScheduledExecutorService service = Executors.newScheduledThreadPool(10);
        // 从现在开始1秒钟之后，每隔1秒钟执行一次job1
        service.scheduleAtFixedRate(new ScheduledExecutorTest("job1"),1L, 1L, TimeUnit.SECONDS);
    }
}
